package com.lebang.service;

import com.alibaba.fastjson.JSONObject;
import com.lebang.common.validcode.ValidCodeUtil;
import com.lebang.component.RedisClient;
import com.lebang.component.UMengPushComponent;
import com.lebang.domain.RankMember;
import com.lebang.entity.LbbDict;
import com.lebang.entity.MemberRankRecord;
import com.lebang.entity.RankSort;
import com.lebang.entity.RequestHeaders;
import com.lebang.entity.member.LbbMember;
import com.lebang.example.MemberRankRecordExample;
import com.lebang.example.RankSortExample;
import com.lebang.mapper.LbbDictMapper;
import com.lebang.mapper.LbbMemberMapper;
import com.lebang.mapper.MemberRankRecordMapper;
import com.lebang.mapper.RankSortMapper;
import com.lebang.model.QuerRankDate;
import com.lebang.model.enums.RandRecordEnums;
import com.lebang.model.enums.RankEnums;
import com.lebang.service.sys.DictService;
import com.lebangweb.common.TextUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Tuple;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import static com.lebang.controller.api.RankingApi.*;

/**
 * @Author: hwq
 * @Date: 2019/11/4 10:37
 * @Version 1.0
 */
@Service
@Slf4j
public class RankingService {
    @Autowired
    private DictService dictService;
    @Autowired
    private RedisClient redisClient;
    @Resource
    private RankSortMapper rankSortMapper;
    @Autowired
    private MemberRankRecordMapper recordMapper;
    @Autowired
    private UMengPushComponent uMengPushComponent;
    @Autowired
    private MemberNoticeService noticeService;
    @Autowired
    private LbbDictMapper lbbDictMapper;
    @Autowired
    private ValidCodeUtil validCodeUtil;
    @Autowired
    private LbbMemberMapper memberMapper;
    //未上榜信息，每个号只需推送一次
    private static final String DAY_1_TITLE = "日榜第一奖励{money}元";
    private static final String DAY_1 = "任务得红包，一起来冲榜!日榜第一可得{money}元红包，今日累计再获得{score}元即可进入奖励区抢夺红包！";
    private static final String WEEK_1_TITLE = "周榜第一奖励{money}元";
    private static final String WEEK_1 = "周榜冲起来，红包拿不停！周榜第一可得{money}元红包，周累计再获得{score}元即可进入奖励区抢夺红包！";

    //差距信息，有上榜玩家每日推送一次
    private static final String DAY_2_TITLE = "恭喜上日榜";
    private static final String DAY_2 = "任务得红包，一起来冲榜！当前日榜排名第{sort}名，还差{score}元可晋升排名，点击前往抢榜！";
    private static final String WEEK_2_TITLE = "恭喜上周榜";
    private static final String WEEK_2 = "周榜冲起来，红包拿不停！当前周榜排名第{sort}名，还差{score}元可晋升排名，点击前往抢榜！";
    private static final String FIRST_DAY_TITLE = "日榜暂排第一";
    private static final String FIRST_WEEK_TITLE = "周榜暂排第一";

    /**
     * 排行榜积分变化
     *
     * @param memberId
     * @param score
     */

    public void memberAddScore(String memberId, Integer score) {
        long updateTime = System.currentTimeMillis();
        double timeRank = score + 1 - updateTime / Math.pow(10, (int) Math.log10(updateTime) + 1);

        //日榜
        Double memberDayScore = redisClient.zscore(RANKING_DAY, memberId);
        if (memberDayScore == null) {
            redisClient.zadd(RANKING_DAY, timeRank, memberId);
        } else {
            int points = memberDayScore.intValue();
            redisClient.zadd(RANKING_DAY, points + timeRank, memberId);
        }
        //周榜
        Double memberWeekScore = redisClient.zscore(RANKING_WEEK, memberId);
        if (memberWeekScore == null) {
            redisClient.zadd(RANKING_WEEK, timeRank, memberId);
        } else {
            int points = memberWeekScore.intValue();
            redisClient.zadd(RANKING_WEEK, points + timeRank, memberId);
        }
    }

    /**
     * 排行榜积分变化
     *
     * @param memberId
     * @param score
     */

    public void memberAddScore1(String memberId, Integer score) {
        long updateTime = System.currentTimeMillis();
        double timeRank = score + 1 - updateTime / Math.pow(10, (int) Math.log10(updateTime) + 1);

        //日榜
        Double memberDayScore = redisClient.zscore(RANKING_DAY, memberId);
        if (memberDayScore == null) {
            redisClient.zadd(RANKING_DAY, timeRank, memberId);
        } else {
            int points = memberDayScore.intValue();
            redisClient.zadd(RANKING_DAY, points + timeRank, memberId);
        }
//
    }

    /**
     * 结算日榜
     */

    public void dayOver() {
        int maxSort = rankSortMapper.selectMaxSort();
        Set<Tuple> set = redisClient.zrevrangeWithScores(RANKING_DAY, 0, maxSort - 1);
        redisClient.del(RANKING_DAY);

        if (!enableByKey(RANKING_DAY)) {
            return;
        }
        LocalDateTime date = LocalDateTime.now().minusHours(1);
        LocalDateTime starTime = LocalDateTime.of(date.toLocalDate(), LocalTime.MIN);
        // 结束
        LocalDateTime endTime = LocalDateTime.of(date.toLocalDate(), LocalTime.MAX).minusSeconds(1);
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        RankSortExample example = new RankSortExample();
        example.createCriteria().andHasDeletedEqualTo(0);
        List<RankSort> list = rankSortMapper.selectByExample(example);
        int i = 1;
        for (Tuple s : set) {
            int k = this.getDayMoneyForSort(i, list, RANKING_DAY);
            if (k != 0) {
                //添加待领奖
                LbbMember member = memberMapper.getMemberByMemberId(s.getElement());

                if (member == null) {
                    continue;
                }


                MemberRankRecord rankRecord = new MemberRankRecord();
                rankRecord.setCreateTime(LocalDateTime.now());
                rankRecord.setMoney(k);
                rankRecord.setMemberId(s.getElement());
                rankRecord.setStatus(RandRecordEnums.WAIT.getIndex());
                rankRecord.setType(RankEnums.DAY.getIndex());
                rankRecord.setMsg("恭喜获得昨日日榜第"+i+"名奖励");
                rankRecord.setTitle("榜单日榜奖励");
                rankRecord.setDate(date.format(df));
                if (TextUtil.isMobile(member.getNickname())) {
                    rankRecord.setMemberName("尾号" + member.getNickname().substring(member.getNickname().length() - 4));
                } else {
                    rankRecord.setMemberName(member.getNickname());
                }
                int points = Double.valueOf(s.getScore()).intValue();
                rankRecord.setMemberScore((double) points);
                rankRecord.setMemberSort(i);
                rankRecord.setStarTime(starTime);
                rankRecord.setEndTime(endTime);
                recordMapper.insertSelective(rankRecord);
                noticeService.addNotice("恭喜获得日榜第" + i + "名", "恭喜您在" + date.format(df) + "获得日榜奖励" + new BigDecimal(rankRecord.getMoney()).divide(new BigDecimal(100)) + "元红包，请及时登录领取!", s.getElement(), new RequestHeaders());
                uMengPushComponent.sendNoRead("恭喜获得日榜第" + i + "名", "恭喜您在" + date.format(df) + "获得日榜奖励" + new BigDecimal(rankRecord.getMoney()).divide(new BigDecimal(100)) + "元红包，请及时登录领取!", s.getElement());

                if (TextUtil.isPhone(member.getPhone())) {
                    validCodeUtil.sendMsg(member.getPhone(), "181227", "日榜","list");
                }
                i++;
            }
        }

    }

    /**
     * 结算周榜
     */
    public void weekOver() {
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        // 获取当前时间
        LocalDateTime inputDate = LocalDateTime.now().minusHours(1);
        // 本周起始时间
        TemporalAdjuster FIRST_OF_WEEK =
                TemporalAdjusters.ofDateAdjuster(localDate -> localDate.minusDays(localDate.getDayOfWeek().getValue() - DayOfWeek.MONDAY.getValue()));

        LocalDateTime starTime = LocalDateTime.of(inputDate.toLocalDate().with(FIRST_OF_WEEK), LocalTime.MIN);
        String weekStart = df.format(starTime);
        // 本周结束时间
        TemporalAdjuster LAST_OF_WEEK =
                TemporalAdjusters.ofDateAdjuster(localDate -> localDate.plusDays(DayOfWeek.SUNDAY.getValue() - localDate.getDayOfWeek().getValue()));
        LocalDateTime endTime = LocalDateTime.of(inputDate.toLocalDate().with(LAST_OF_WEEK), LocalTime.MAX).minusSeconds(1);
        String weekEnd = df.format(endTime);
        RankSortExample example = new RankSortExample();
        example.createCriteria().andHasDeletedEqualTo(0);
        List<RankSort> list = rankSortMapper.selectByExample(example);
        int end = recordMapper.checkWeekEnd(weekStart + "-" + weekEnd);
        if (end > 0) {
            log.info("本周周榜已结算");
            return;
        }
        int maxSort = rankSortMapper.selectMaxSort();
        Set<Tuple> set = redisClient.zrevrangeWithScores(RANKING_WEEK, 0, maxSort - 1);
        redisClient.del(RANKING_WEEK);
        LbbDict dict = lbbDictMapper.selectByKeyName(BANGDANG_ENABLE);
        if ("0".equals(dict.getKeyvalue())) {
            return;
        }
        if (!enableByKey(RANKING_WEEK)) {
            return;
        }


        int i = 1;
        for (Tuple s : set) {
            int k = this.getWeekMoneyForSort(i, list);
            if (k != 0) {
                //添加待领奖
                LbbMember member = memberMapper.getMemberByMemberId(s.getElement());

                if (member == null) {
                    continue;
                }

                MemberRankRecord rankRecord = new MemberRankRecord();
                rankRecord.setCreateTime(LocalDateTime.now());
                rankRecord.setMoney(k);
                rankRecord.setMemberId(s.getElement());
                rankRecord.setStatus(RandRecordEnums.WAIT.getIndex());
                rankRecord.setType(RankEnums.WEEK.getIndex());
                rankRecord.setMsg("恭喜获得上周周榜第" + i +"名奖励");
                rankRecord.setTitle("榜单周榜奖励");
                rankRecord.setDate(weekStart + "-" + weekEnd);
                if (TextUtil.isMobile(member.getNickname())) {
                    rankRecord.setMemberName("尾号" + member.getNickname().substring(member.getNickname().length() - 4));
                } else {
                    rankRecord.setMemberName(member.getNickname());
                }
                int points = Double.valueOf(s.getScore()).intValue();
                rankRecord.setMemberScore((double) points);
                rankRecord.setMemberSort(i);


                rankRecord.setStarTime(starTime);
                rankRecord.setEndTime(endTime);
                recordMapper.insertSelective(rankRecord);
                noticeService.addNotice("恭喜获得周榜第" + i + "名", "恭喜您获得周榜奖励" + new BigDecimal(rankRecord.getMoney()).divide(new BigDecimal(100)) + "元红包，请及时登录领取!", s.getElement(), new RequestHeaders());
                uMengPushComponent.sendNoRead("恭喜获得周榜第" + i + "名", "恭喜您获得周榜奖励" + new BigDecimal(rankRecord.getMoney()).divide(new BigDecimal(100)) + "元红包，请及时登录领取!", s.getElement());

                if (TextUtil.isPhone(member.getPhone())) {
                    validCodeUtil.sendMsg(member.getPhone(), "181227", "周榜","list");
                }
                i++;
            }
        }

    }


    public List<RankSort> getList() {
        RankSortExample example = new RankSortExample();
        example.createCriteria().andHasDeletedEqualTo(0);
        List<RankSort> list = rankSortMapper.selectByExample(example);
        return list;
    }

    public int getMaxSort() {
        return rankSortMapper.selectMaxSort();
    }

    public RankSort getMaxSortVo() {
        return rankSortMapper.getMaxSortVo();
    }

    public int getWeekMoneyForSort(int i, List<RankSort> list) {
        for (RankSort next : list) {
            if (next.getSort().equals(i)) {
                return next.getWeekMoney();
            }
        }
        return 0;
    }

    public int getDayMoneyForSort(int i, List<RankSort> list, String type) {
        if (type.equals(RANKING_DAY)) {
            for (RankSort next : list) {
                if (next.getSort().equals(i)) {
                    return next.getDayMoney();
                }
            }
            return 0;
        } else {
            for (RankSort next : list) {
                if (next.getSort().equals(i)) {
                    return next.getWeekMoney();
                }
            }
            return 0;
        }

    }


    public List<MemberRankRecord> history(Integer type, String date) {
        MemberRankRecordExample example = new MemberRankRecordExample();
        example.createCriteria().andTypeEqualTo(type).andDateEqualTo(date);
        example.setOrderByClause("member_sort asc");
        return recordMapper.selectByExample(example);
    }

    public int updateRankSort(RankSort sort) {
        return rankSortMapper.updateByPrimaryKeySelective(sort);
    }

    public MemberRankRecord selectByMemberId(String memberId, Integer type) {
        return recordMapper.selectByMemberId(memberId, type);
    }

    public MemberRankRecord selectByMemberId(String memberId) {
        MemberRankRecord record = recordMapper.selectByMemberId(memberId, 1);
        if (record == null) {
            return recordMapper.selectByMemberId(memberId, 2);
        } else {
            return record;
        }
    }

    public int updateRecord(MemberRankRecord rankRecord) {
        return recordMapper.updateByPrimaryKeySelective(rankRecord);
    }

    public int addRankSort(RankSort sort) {
        return rankSortMapper.insertSelective(sort);
    }

    public void recordPush() {
        if (!enableByKey(RANKING_DAY)) {
            return;
        }
        LocalDate localDate = LocalDate.now();
        LocalDateTime star = LocalDateTime.of(localDate, LocalTime.MIN);
        LocalDateTime end = LocalDateTime.of(localDate, LocalTime.MAX);
        star = star.minusHours(5);
        LbbDict dict = lbbDictMapper.selectByKeyName(BANGDANG_ENABLE);
        if ("0".equals(dict.getKeyvalue())) {
            return;
        }
        LocalDateTime time = LocalDateTime.now();
        MemberRankRecordExample example = new MemberRankRecordExample();
        example.createCriteria().andStatusEqualTo(RandRecordEnums.WAIT.getIndex()).andCreateTimeBetween(star, end);
        recordMapper.selectByExample(example).forEach(s -> {
            if (s.getCreateTime().plusDays(1).isAfter(time)) {
                if (s.getType().equals(RankEnums.DAY.getIndex())) {
                    uMengPushComponent.sendNoRead("奖励即将消失！请及时领取", "您于" + s.getDate() + "获得日榜奖励" + new BigDecimal(s.getMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN) + "元红包未领取，请及时登录榜单页领取，该奖励将于今日23:59失效!", s.getMemberId());
                    noticeService.addNotice("奖励即将消失！请及时领取", "您于" + s.getDate() + "获得日榜奖励" + new BigDecimal(s.getMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN) + "元红包未领取，请及时登录榜单页领取，该奖励将于今日23:59失效!", s.getMemberId(), new RequestHeaders());

                } else {
                    noticeService.addNotice("奖励即将消失！请及时领取", "您于" + s.getDate() + "获得周榜奖励" + new BigDecimal(s.getMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN) + "元红包未领取，请及时登录榜单页领取，该奖励将于今日23:59失效!", s.getMemberId(), new RequestHeaders());
                    uMengPushComponent.sendNoRead("奖励即将消失！请及时领取", "您于" + s.getDate() + "获得周榜奖励" + new BigDecimal(s.getMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN) + "元红包未领取，请及时登录榜单页领取，该奖励将于今日23:59失效!", s.getMemberId());

                }
            }
        });
    }

    public void rankPush(String key) {
        LbbDict dict = lbbDictMapper.selectByKeyName(BANGDANG_ENABLE);
        if ("0".equals(dict.getKeyvalue())) {
            return;
        }
        BigDecimal money;
        RankSort rankSort = this.getMaxSortVo();
        if (!enableByKey(key)) {
            return;
        }
        if (key.equals(RANKING_DAY)) {

            money = new BigDecimal(rankSort.getDayMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN);
        } else {
            money = new BigDecimal(rankSort.getWeekMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN);
        }

        int maxSort = this.getMaxSort();
        Set<Tuple> set = redisClient.zrevrangeWithScores(key, 0, -1);
        Set<Tuple> tuples = null;
        Integer i = 1;

        Integer point = 0;
        //判断排行榜里面玩家数量
        if (set.size() < maxSort) {
            tuples = redisClient.zrevrangeWithScores(key, set.size() - 1, set.size() - 1);
        } else {
            tuples = redisClient.zrevrangeWithScores(key, maxSort - 1, maxSort - 1);
        }
        for (Iterator<Tuple> tupleIterator = tuples.iterator(); tupleIterator.hasNext(); ) {
            Tuple tuple = tupleIterator.next();
            point = Double.valueOf(tuple.getScore()).intValue();
        }

        String firstTitle = "";
        for (Iterator<Tuple> iterator = set.iterator(); iterator.hasNext(); ) {
            String str = "";
            String title = "";
            String title2 = "";
            String outStr = "";
            String str1 = "";
            if (key.equals(RANKING_DAY)) {
                str1 = DAY_2;
                title = DAY_1_TITLE.replace("{money}", String.valueOf(money));
                str = DAY_1;
                title2 = DAY_2_TITLE;
                firstTitle = FIRST_DAY_TITLE;
            } else {
                str1 = WEEK_2;
                title = WEEK_1_TITLE.replace("{money}", String.valueOf(money));
                firstTitle = FIRST_WEEK_TITLE;
                str = WEEK_1;
                title2 = WEEK_2_TITLE;
            }
            Tuple next = iterator.next();
            Long memberRank = redisClient.zrevrank(key, next.getElement());
            if (i > maxSort) {
                //未上榜信息，每个号只需推送一次
                tuples = redisClient.zrevrangeWithScores(key, (memberRank) < 0 ? 0 : (memberRank), memberRank);
                Integer points = 0;
                for (Iterator<Tuple> tupleIterator = tuples.iterator(); tupleIterator.hasNext(); ) {
                    Tuple tuple = tupleIterator.next();
                    points = Double.valueOf(tuple.getScore()).intValue();
                }

                outStr = str.replace("{money}", money.toString());
                outStr = outStr.replace("{score}", new BigDecimal((point + 1) - points).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN).toString());
                noticeService.addNotice(title, outStr, next.getElement(), new RequestHeaders());
                uMengPushComponent.sendNoRead(title, outStr, next.getElement());
            } else {
                //差距信息，有上榜玩家每日推送一次
                if (memberRank > 0) {
                    tuples = redisClient.zrevrangeWithScores(key, (memberRank - 1) < 0 ? 0 : (memberRank - 1), memberRank - 1);
                    Integer points = 0;
                    for (Iterator<Tuple> tupleIterator = tuples.iterator(); tupleIterator.hasNext(); ) {
                        Tuple tuple = tupleIterator.next();
                        points = Double.valueOf(tuple.getScore()).intValue();
                    }
                    str1 = str1.replace("{sort}", i.toString());
                    points = points + 1 - Double.valueOf(next.getScore()).intValue();
                    str1 = str1.replace("{score}", new BigDecimal(points).divide(new BigDecimal(100)).toString());
                    noticeService.addNotice(title2, str1, next.getElement(), new RequestHeaders());
                    uMengPushComponent.sendNoRead(title2, str1, next.getElement());
                } else {
                    //第一名
                    noticeService.addNotice(firstTitle, "恭喜独占鳌头，注意保持哦！", next.getElement(), new RequestHeaders());
                    uMengPushComponent.sendNoRead(firstTitle, "恭喜独占鳌头，注意保持哦！", next.getElement());
                }
            }
            i++;
        }
//        //批量推送超出排行榜的用户
//        for (String member : stringList) {
//            noticeService.addNotice(outStr, outStr, member,new RequestHeaders());
//        }
//        List<List<String>> sprateList = ListUtils.partition(stringList, 500);
//        List<String> pushList = new ArrayList<>();
//        sprateList.forEach(s -> pushList.add(String.join(",", s)));
//        for (String member : pushList) {
//            uMengPushComponent.sendNoRead(outStr, outStr, member);
//        }
    }

    public List<QuerRankDate> getdate(Integer type) {

        List<QuerRankDate> list = recordMapper.selectDayDate(type);
        return list;
    }

    public boolean enableByKey(String key) {
        if (key.equals(RANKING_DAY)) {
            return dictService.selectIntByKeyName("ribangkaiguan") > 0;
        } else {
            return dictService.selectIntByKeyName("zhoubangkaiguan") > 0;
        }
    }

    /**
     * 扣分
     * @param memberId
     * @param score
     */
    public void membersubScore(String memberId, int score) {
        long updateTime = System.currentTimeMillis();
        double timeRank = score + 1 - updateTime / Math.pow(10, (int) Math.log10(updateTime) + 1);

        //日榜
        Double memberDayScore = redisClient.zscore(RANKING_DAY, memberId);
        if (memberDayScore == null) {
            redisClient.zadd(RANKING_DAY, timeRank, memberId);
        } else {
            int points = memberDayScore.intValue();
            redisClient.zadd(RANKING_DAY, points - timeRank, memberId);
        }
        //周榜
        Double memberWeekScore = redisClient.zscore(RANKING_WEEK, memberId);
        if (memberWeekScore == null) {
            redisClient.zadd(RANKING_WEEK, timeRank, memberId);
        } else {
            int points = memberWeekScore.intValue();
            redisClient.zadd(RANKING_WEEK, points - timeRank, memberId);
        }
    }

    public int getMax(List<RankMember> rankMemberList) {
        List<String> ranks = new ArrayList<>();
        rankMemberList.forEach(s->{ranks.add(s.getMemberId());});
        int maxSort = rankSortMapper.selectMaxSort();
        Set<Tuple> set = redisClient.zrevrangeWithScores(RANKING_DAY, 0, maxSort - 1);
        for (Tuple s : set) {
            if(ranks.contains(s.getElement())){
                continue;
            }
            return Double.valueOf(s.getScore()).intValue();
        }
        return 0;
    }

    public JSONObject getRewardMoney() {
        JSONObject jsonObject = new JSONObject();
        RankSortExample example = new RankSortExample();
        example.createCriteria().andHasDeletedEqualTo(0);
        List<RankSort> list = rankSortMapper.selectByExample(example);
        list.forEach(s->{
            if(s.getSort()==1){
                jsonObject.put("dayFirst",new BigDecimal(s.getDayMoney()).divide(new BigDecimal(100)));
                jsonObject.put("weekFirst",new BigDecimal(s.getWeekMoney()).divide(new BigDecimal(100)));
            }else if(s.getSort()==2){
                jsonObject.put("daySecond",new BigDecimal(s.getDayMoney()).divide(new BigDecimal(100)));
                jsonObject.put("weekSecond",new BigDecimal(s.getWeekMoney()).divide(new BigDecimal(100)));
            }else if(s.getSort()==3){
                jsonObject.put("dayThird",new BigDecimal(s.getDayMoney()).divide(new BigDecimal(100)));
                jsonObject.put("weekThird",new BigDecimal(s.getWeekMoney()).divide(new BigDecimal(100)));
            }else if(s.getSort()==4){
                jsonObject.put("dayFour",new BigDecimal(s.getDayMoney()).divide(new BigDecimal(100)));
                jsonObject.put("weekFour",new BigDecimal(s.getWeekMoney()).divide(new BigDecimal(100)));
            }else if(s.getSort()==6){
                jsonObject.put("dayFive",new BigDecimal(s.getDayMoney()).divide(new BigDecimal(100)));
                jsonObject.put("weekFive",new BigDecimal(s.getWeekMoney()).divide(new BigDecimal(100)));
            }else if(s.getSort()==11){
                jsonObject.put("daySix",new BigDecimal(s.getDayMoney()).divide(new BigDecimal(100)));
                jsonObject.put("weekSix",new BigDecimal(s.getWeekMoney()).divide(new BigDecimal(100)));
            }
        });

        return jsonObject;
    }
}
